import java.util.Arrays;

public class Leet274 {
    public static void main(String[] args) {
        System.out.println(hIndex(new int[]{11,15}));
    }
    static public int hIndex(int[] citations) {
        Arrays.sort(citations);
        int num = 0;
        for (int i = citations.length-1; i >= 0 ; i--) {
            if (citations[i] <= num)
                return num;
            num++;
        }
        return num;
    }
}
